angular.module('Controller')
.controller('WFHeaderCtrl', ($scope,userData,$http, $rootScope,menuManage, $location)->
#    console.log('213')
    $scope.user=userData.getUser()
    $scope.msgInfo={}
    $scope.dropUser=()->
        if  $('#userLabel').hasClass('open')
            $('#userLabel').removeClass('open')
        else
            $('#userLabel').addClass('open')
        ''
    loadMessageInfo=()->
        reqData={
            page:0
            size:10
        }
        $http.get("/notification/my",params:reqData)
        .success((resp)->
            if resp.code==0
                $('#UnReadMsgNum').css('display','block')
                unReadMsgList=_.filter(resp.message.content,(theItem)->theItem.readFlag==false)
                $scope.msgInfo.UnReadMsgNum=unReadMsgList.length
                console.log('$scope.msgInfo.UnReadMsgNum',$scope.msgInfo.UnReadMsgNum)
        )
    loadMessageInfo()
    $scope.goMyMsg=()->
        loadMessageInfo()
        menuManage.goState('my-message',true)
    $scope.loginOut=()->
        userData.login()
    $rootScope.$on('refresh-msg',()->
        loadMessageInfo()
    )
)